package com.partsoft.dits.transform;

import com.partsoft.dits.message.MessageEntity;


/**
 *TODO 需要实现序列化， 谁来补充？
 *转换异常 
 */
public class TransformException extends Exception {

	private static final long serialVersionUID = 5027935166625752390L;
	
	private MessageEntity messageEntity;
	
	private String transformScript;
	
	/**
	 * 默认构造函数
	 */
	public TransformException() {
		super();
	}
	
	/**
	 * @param message 错误内容
	 */
	public TransformException(String message) {
		this(message, (String)null);
	}

	/**
	 * @param message 错误内容
	 * @param transformScript 原始XML
	 */
	public TransformException(String message, String sourceTransformScript) {
		this(message, null, sourceTransformScript);
	}

	/**
	 * @param entity 消息实体
	 */
	public TransformException(MessageEntity entity) {
		this(entity, (String)null);
	}
	
	/**
	 * @param entity 消息实体
	 * @param transformScript 原始XML
	 */
	public TransformException(MessageEntity entity, String sourceTransformScript) {
		super();
		this.messageEntity = entity;
		this.transformScript = sourceTransformScript;
	}
	

	/**
	 * @param message 错误内容
	 * @param entity 错误节点
	 */
	public TransformException(String message, MessageEntity entity) {
		this(message, entity, (String)null);
	}
	
	/**
	 * @param message 错误内容
	 * @param entity 消息实体
	 * @param transformScript 原始XML
	 */
	public TransformException(String message, MessageEntity entity, String sourceTransformScript) {
		super(message);
		this.messageEntity = entity;
		this.transformScript = sourceTransformScript;
	}
	
	
	/**
	 * @param message 错误内容
	 * @param entity 消息实体
	 * @param e  级联异常
	 */
	public TransformException(String message, MessageEntity entity, Throwable e) {
		this(message, entity, null, e);
	}
	
	/**
	 * @param message 错误内容
	 * @param transformScript 原始XML
	 * @param e 级联错误
	 */
	public TransformException(String message, String sourceTransformScript, Throwable e) {
		this(message, null, sourceTransformScript, e);
	}
	
	
	/**
	 * @param message 错误内容
	 * @param entity 消息实体
	 * @param transformScript 原始XML
	 * @param e 级联异常
	 */
	public TransformException(String message, MessageEntity entity, String sourceTransformScript, Throwable e) {
		super(message, e);
		this.messageEntity = entity;
		this.transformScript = sourceTransformScript;
	}
	
	/**
	 * @param entity 消息实体
	 * @param transformScript 原始XML
	 * @param e 级联异常
	 */
	public TransformException(MessageEntity entity, String sourceTransformScript, Throwable e) {
		super(e);
		this.messageEntity = entity;
		this.transformScript = sourceTransformScript;
	}

	/**
	 * @param entity 消息实体
	 * @param e 原始XML
	 */
	public TransformException(MessageEntity entity, Throwable e) {
		super(e);
		this.messageEntity = entity;
	}
	
	/**
	 * @param message 错误消息
	 * @param e 级联异常
	 */
	public TransformException(String message, Throwable e) {
		super(message, e);
	}
	
	/**
	 * @param e 级联异常
	 */
	public TransformException(Throwable e) {
		super(e);
	}
	
	/**
	 * @return 消息实体
	 */
	public MessageEntity getMessageEntity() {
		return messageEntity;
	}
	
	/**
	 * 转换模板
	 * @return
	 */
	public String getTransformScript() {
		return transformScript;
	}
	
}
